<?php

if (! defined('LIB_PATH'))
{
    die('The file ' . __FILE__ . ' needs to be required from the main executable of PhpPhoenix');
}

/**
 * This class is inheriting the PhpElement class
 *
 * @see PhpElement
 */
require_once LIB_PATH . 'PhpElement.php';

/**
 * PhpMethod 
 * 
 * @uses PhpElement
 * @package php-phoenix
 * @subpackage models
 * @version $id$
 * @copyright 
 * @author Pablo López Torres <pablolopeztorres@gmail.com> 
 * @license 
 */
class PhpMethod extends PhpElement
{

    /**
     * class 
     * 
     * Class containing this method
     * 
     * @var PhpClass
     * @access private
     */
    private $class;

    /**
     * className 
     * 
     * Name of the class containing this method
     * 
     * @var PhpClass
     * @access private
     */
    private $className;

	/**
	 * getClassName
	 * 
	 * @author Pablo López Torres <pablolopeztorres@gmail.com>
	 * @access public
	 * @return void
	 */
	public function getClassName()
	{
		return $this->className;
	}

	/**
	 * getClass
	 * 
	 * @author Pablo López Torres <pablolopeztorres@gmail.com>
	 * @access public
	 * @return void
	 */
	public function getClass()
	{
        if (! isset($this->class))
        {
            // @todo pablo - where this should be moved? (maybe to a helper)
            // get the storage key that have the object
            $persistentKey = CURRENT_PROJECT . '_class_' . $this->extends;
            
            $this->class = Storage::load($persistentKey);

            if ($this->class === NULL)
            {
                echo "Class '$this->className' could not be loaded.\n";
            }
        }
        return $this->class;
	}
	
}


